package com.se.nused;

import lombok.extern.log4j.Log4j2;
import org.apache.logging.log4j.Level;

/**
 * @Author: hdu_huang
 * @Date: 2018/12/25 15:46
 */
@Log4j2
public class Log4j2Test {

    // log4j2 可以直接 info(Object var)  slf4j只能info(String var), 调试用log4j2，生产用slf4j
    public static void main(String[] args) {

        int sum = 10;
        log.trace(sum);
        log.debug(sum);
        log.info(sum);
        log.warn(sum);
        log.error(sum);
        log.fatal(sum);

        String world = "world!";
        log.trace("hello {}", world);
        log.debug("hello {}", world);
        log.info("hello {}", world);
        log.warn("hello {}", world);
        log.error("hello {}", world);
        log.fatal("hello {}", world);

        log.log(Level.ALL, sum * 2);
        log.log(Level.TRACE, sum * 2);
        log.log(Level.DEBUG, sum * 2);
        log.log(Level.INFO, sum * 2);
        log.log(Level.WARN, sum * 2);
        log.log(Level.ERROR, sum * 2);
        log.log(Level.FATAL, sum * 2);
    }
}
